
<!doctype html>
<html lang="en" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      
        <link rel="prev" href="../picto/">
      
      
        <link rel="next" href="../eugenia/">
      
      <link rel="icon" href="../../assets/images/favicon.png">
      <meta name="generator" content="mkdocs-1.4.3, mkdocs-material-9.1.19">
    
    
      
        <title>Flexmi - Epsilon</title>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/main.eebd395e.min.css">
      
        
        <link rel="stylesheet" href="../../assets/stylesheets/palette.ecc896b0.min.css">
      
      

    
    
    
      
        
        
        <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
        <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/mermaid.css">
    
      <link rel="stylesheet" href="../../assets/javascript/google-code-prettify/prettify.css">
    
      <link rel="stylesheet" href="https://unpkg.com/mermaid@8.5.1/dist/mermaid.css">
    
      <link rel="stylesheet" href="../../assets/stylesheets/slick.css">
    
      <link rel="stylesheet" href="../../assets/stylesheets/slick-theme.css">
    
      <link rel="stylesheet" href="../../assets/stylesheets/extra.css">
    
    <script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
    
      
<script>
  window.ga = window.ga || function() {
    (ga.q = ga.q || []).push(arguments)
  }
  ga.l = +new Date
  /* Setup integration and send page view */
  ga("create", "UA-184785655-1", "auto")
  ga("set", "anonymizeIp", true)
  ga("send", "pageview")
  /* Register handler to log search on blur */
  document.addEventListener("DOMContentLoaded", () => {
    if (document.forms.search) {
      var query = document.forms.search.query
      query.addEventListener("blur", function() {
        if (this.value) {
          var path = document.location.pathname;
          ga("send", "pageview", path + "?q=" + this.value)
        }
      })
    }
  })
</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
    
    
    
  </head>
  
  
    
    
    
    
    
    <body dir="ltr" data-md-color-scheme="default" data-md-color-primary="black" data-md-color-accent="orange">
  
    
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#flexmi" class="md-skip">
          Skip to content
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
    
      

  

<header class="md-header md-header--shadow" data-md-component="header">
  <nav class="md-header__inner md-grid" aria-label="Header">
    <a href="../.." title="Epsilon" class="md-header__button md-logo" aria-label="Epsilon" data-md-component="logo">
      
  <img src="../../assets/images/epsilon-white-background.png" alt="logo">

    </a>
    <label class="md-header__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
    </label>
    <div class="md-header__title" data-md-component="header-title">
      <div class="md-header__ellipsis">
        <div class="md-header__topic">
          <span class="md-ellipsis">
            Epsilon
          </span>
        </div>
        <div class="md-header__topic" data-md-component="header-topic">
          <span class="md-ellipsis">
            
              Flexmi
            
          </span>
        </div>
      </div>
    </div>
    
      
    
    
    
      <label class="md-header__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
      </label>
      <div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
      </label>
      <nav class="md-search__options" aria-label="Search">
        
        <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
        </button>
      </nav>
      
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list" role="presentation"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
      <div class="md-header__source">
        <a href="https://github.com/eclipse/epsilon" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Epsilon @ GitHub
  </div>
</a>
      </div>
    
  </nav>
  
</header>
    
    <div class="md-container" data-md-component="container">
      
      
        
          
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              
              <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    


<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../.." title="Epsilon" class="md-nav__button md-logo" aria-label="Epsilon" data-md-component="logo">
      
  <img src="../../assets/images/epsilon-white-background.png" alt="logo">

    </a>
    Epsilon
  </label>
  
    <div class="md-nav__source">
      <a href="https://github.com/eclipse/epsilon" title="Go to repository" class="md-source" data-md-component="source">
  <div class="md-source__icon md-icon">
    
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81z"/></svg>
  </div>
  <div class="md-source__repository">
    Epsilon @ GitHub
  </div>
</a>
    </div>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../.." class="md-nav__link">
        Home
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../getting-started/" class="md-nav__link">
        Getting Started
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../playground" class="md-nav__link">
        Playground
      </a>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../download/" class="md-nav__link">
        Download
      </a>
    </li>
  

    
      
      
      

  
  
    
  
  
    
    <li class="md-nav__item md-nav__item--active md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
      
      
      
        <label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
          Documentation
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
        <label class="md-nav__title" for="__nav_5">
          <span class="md-nav__icon md-icon"></span>
          Documentation
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../" class="md-nav__link">
        Overview
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../emc/" class="md-nav__link">
        Model Connectivity
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" >
      
      
      
        <label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="0">
          Languages
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5_3">
          <span class="md-nav__icon md-icon"></span>
          Languages
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../eol/" class="md-nav__link">
        Object Language (EOL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../egl/" class="md-nav__link">
        Code Generation (EGL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../egx/" class="md-nav__link">
        Code Generation (EGX)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../evl/" class="md-nav__link">
        Model Validation (EVL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../etl/" class="md-nav__link">
        Model Transformation (ETL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../ecl/" class="md-nav__link">
        Model Comparison (ECL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../eml/" class="md-nav__link">
        Model Merging (EML)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../epl/" class="md-nav__link">
        Pattern Matching (EPL)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../flock/" class="md-nav__link">
        Model Migration (Flock)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../emg/" class="md-nav__link">
        Model Generation (EMG)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../eunit/" class="md-nav__link">
        Unit Testing (EUnit)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../pinset/" class="md-nav__link">
        Dataset Extraction (Pinset)
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../ewl/" class="md-nav__link">
        Wizard Language (EWL)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
    
  
  
    
    <li class="md-nav__item md-nav__item--active md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" checked>
      
      
      
        <label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="0">
          Tools
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="true">
        <label class="md-nav__title" for="__nav_5_4">
          <span class="md-nav__icon md-icon"></span>
          Tools
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../picto/" class="md-nav__link">
        Picto
      </a>
    </li>
  

            
          
            
              
  
  
    
  
  
    <li class="md-nav__item md-nav__item--active">
      
      <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
      
      
        
      
      
        <label class="md-nav__link md-nav__link--active" for="__toc">
          Flexmi
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <a href="./" class="md-nav__link md-nav__link--active">
        Flexmi
      </a>
      
        

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
    
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#getting-started" class="md-nav__link">
    Getting started
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#fuzzy-parsing" class="md-nav__link">
    Fuzzy Parsing
  </a>
  
    <nav class="md-nav" aria-label="Fuzzy Parsing">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#non-containment-reference-resolution" class="md-nav__link">
    Non-Containment Reference Resolution
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#long-attribute-values" class="md-nav__link">
    Long Attribute Values
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#attribute-assignment" class="md-nav__link">
    Attribute Assignment
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#executable-attributes" class="md-nav__link">
    Executable Attributes
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#object-initialization" class="md-nav__link">
    Object Initialization
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#including-and-importing-other-flexmi-models" class="md-nav__link">
    Including and Importing other Flexmi Models
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#instantiating-types-from-multiple-ecore-metamodels" class="md-nav__link">
    Instantiating Types from Multiple Ecore Metamodels
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#models-with-multiple-root-elements" class="md-nav__link">
    Models with Multiple Root Elements
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#reusable-templates" class="md-nav__link">
    Reusable Templates
  </a>
  
    <nav class="md-nav" aria-label="Reusable Templates">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#parameters" class="md-nav__link">
    Parameters
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dynamic-templates-and-slots" class="md-nav__link">
    Dynamic Templates and Slots
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#reusing-templates-in-different-flexmi-models" class="md-nav__link">
    Reusing Templates in Different Flexmi Models
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#use-in-epsilon-and-java" class="md-nav__link">
    Use in Epsilon and Java
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#converting-to-xmi" class="md-nav__link">
    Converting to XMI
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#yaml-flavour" class="md-nav__link">
    YAML Flavour
  </a>
  
    <nav class="md-nav" aria-label="YAML Flavour">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dynamic-templates-in-yaml" class="md-nav__link">
    Dynamic Templates in YAML
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#philosophy" class="md-nav__link">
    Philosophy
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#limitations" class="md-nav__link">
    Limitations
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#resources" class="md-nav__link">
    Resources
  </a>
  
</li>
      
    </ul>
  
</nav>
      
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../eugenia/" class="md-nav__link">
        Eugenia
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../exeed/" class="md-nav__link">
        Exeed
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../modelink/" class="md-nav__link">
        Modelink
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../hutn/" class="md-nav__link">
        HUTN
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../workflow/" class="md-nav__link">
        Workflow (Ant tasks)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../articles/" class="md-nav__link">
        Articles
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../examples/" class="md-nav__link">
        Examples
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.youtube.com/epsilondevs" class="md-nav__link">
        Screencasts
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.youtube.com/playlist?list=PLRwHao6Ue0YUecg7vEUQTrtySIWwrd_mI" class="md-nav__link">
        Lectures
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_9" >
      
      
      
        <label class="md-nav__link" for="__nav_5_9" id="__nav_5_9_label" tabindex="0">
          Javadoc
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_9_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_5_9">
          <span class="md-nav__icon md-icon"></span>
          Javadoc
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://download.eclipse.org/epsilon/stable-javadoc/" class="md-nav__link">
        Stable
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://download.eclipse.org/epsilon/interim-javadoc/" class="md-nav__link">
        Interim
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
      
      
      
        <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
          Issues
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_6">
          <span class="md-nav__icon md-icon"></span>
          Issues
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://github.com/eclipse/epsilon/issues/new/choose" class="md-nav__link">
        Report a new issue
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://github.com/eclipse/epsilon/issues" class="md-nav__link">
        View open issues
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://bugs.eclipse.org/bugs/buglist.cgi?product=epsilon&cmdtype=doit&order=Reuse+same+sort+as+last+time" class="md-nav__link">
        Bugzilla (legacy)
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" >
      
      
      
        <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0">
          Community
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7">
          <span class="md-nav__icon md-icon"></span>
          Community
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_1" >
      
      
      
        <label class="md-nav__link" for="__nav_7_1" id="__nav_7_1_label" tabindex="0">
          Who is using Epsilon?
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_1_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7_1">
          <span class="md-nav__icon md-icon"></span>
          Who is using Epsilon?
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../users/" class="md-nav__link">
        Industry
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../users/education/" class="md-nav__link">
        Education
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../users/open-source/" class="md-nav__link">
        Open-source Projects
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://projects.eclipse.org/projects/modeling.epsilon/who" class="md-nav__link">
        Who is developing Epsilon?
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://ko-fi.com/eclipseepsilon" class="md-nav__link">
        How can I support Epsilon?
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://www.eclipse.org/forums/index.php/f/22/" class="md-nav__link">
        Forum
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../professional-services" class="md-nav__link">
        Professional Services
      </a>
    </li>
  

            
          
            
              
  
  
  
    
    <li class="md-nav__item md-nav__item--nested">
      
      
      
      
      <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7_6" >
      
      
      
        <label class="md-nav__link" for="__nav_7_6" id="__nav_7_6_label" tabindex="0">
          Social Media
          <span class="md-nav__icon md-icon"></span>
        </label>
      
      <nav class="md-nav" data-md-level="2" aria-labelledby="__nav_7_6_label" aria-expanded="false">
        <label class="md-nav__title" for="__nav_7_6">
          <span class="md-nav__icon md-icon"></span>
          Social Media
        </label>
        <ul class="md-nav__list" data-md-scrollfix>
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://twitter.com/eclipseepsilon" class="md-nav__link">
        Twitter
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="https://youtube.com/epsilondevs" class="md-nav__link">
        YouTube
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../labs/" class="md-nav__link">
        Epsilon Labs
      </a>
    </li>
  

            
          
            
              
  
  
  
    <li class="md-nav__item">
      <a href="../../faq/" class="md-nav__link">
        Frequently Asked Questions
      </a>
    </li>
  

            
          
        </ul>
      </nav>
    </li>
  

    
      
      
      

  
  
  
    <li class="md-nav__item">
      <a href="../../branding/" class="md-nav__link">
        Branding
      </a>
    </li>
  

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              
              <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    

<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
  
  
  
    
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon"></span>
      Table of contents
    </label>
    <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#getting-started" class="md-nav__link">
    Getting started
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#fuzzy-parsing" class="md-nav__link">
    Fuzzy Parsing
  </a>
  
    <nav class="md-nav" aria-label="Fuzzy Parsing">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#non-containment-reference-resolution" class="md-nav__link">
    Non-Containment Reference Resolution
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#long-attribute-values" class="md-nav__link">
    Long Attribute Values
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#attribute-assignment" class="md-nav__link">
    Attribute Assignment
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#executable-attributes" class="md-nav__link">
    Executable Attributes
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#object-initialization" class="md-nav__link">
    Object Initialization
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#including-and-importing-other-flexmi-models" class="md-nav__link">
    Including and Importing other Flexmi Models
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#instantiating-types-from-multiple-ecore-metamodels" class="md-nav__link">
    Instantiating Types from Multiple Ecore Metamodels
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#models-with-multiple-root-elements" class="md-nav__link">
    Models with Multiple Root Elements
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#reusable-templates" class="md-nav__link">
    Reusable Templates
  </a>
  
    <nav class="md-nav" aria-label="Reusable Templates">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#parameters" class="md-nav__link">
    Parameters
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#dynamic-templates-and-slots" class="md-nav__link">
    Dynamic Templates and Slots
  </a>
  
</li>
        
          <li class="md-nav__item">
  <a href="#reusing-templates-in-different-flexmi-models" class="md-nav__link">
    Reusing Templates in Different Flexmi Models
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#use-in-epsilon-and-java" class="md-nav__link">
    Use in Epsilon and Java
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#converting-to-xmi" class="md-nav__link">
    Converting to XMI
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#yaml-flavour" class="md-nav__link">
    YAML Flavour
  </a>
  
    <nav class="md-nav" aria-label="YAML Flavour">
      <ul class="md-nav__list">
        
          <li class="md-nav__item">
  <a href="#dynamic-templates-in-yaml" class="md-nav__link">
    Dynamic Templates in YAML
  </a>
  
</li>
        
      </ul>
    </nav>
  
</li>
      
        <li class="md-nav__item">
  <a href="#philosophy" class="md-nav__link">
    Philosophy
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#limitations" class="md-nav__link">
    Limitations
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#resources" class="md-nav__link">
    Resources
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          
            <div class="md-content" data-md-component="content">
              <article class="md-content__inner md-typeset">
                
                  

  
  


<h1 id="flexmi">Flexmi<a class="headerlink" href="#flexmi" title="Permanent link">&para;</a></h1>
<p>Flexmi (pronounced <em>flex-em-eye</em>) is a <strong>reflective textual syntax for EMF models</strong>. Flexmi supports an XML-based and a <a href="#yaml-flavour">YAML-based</a> flavour and offers features such as fuzzy matching of tags and attributes against Ecore class/feature names, support for embedding EOL expressions in models and for defining and instantiating model element templates. For example, the following XML document (<code>acme.flexmi</code>):</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Analysis&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Design&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;4&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;6&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Implementation&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;7&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<p>is a valid instance of the Ecore metamodel (in Emfatic) below (<code>psl</code> stands for Project Scheduling Language):</p>
<pre class="prettyprint lang-emf"><code>@namespace(uri="psl", prefix="")
package psl;

class Project {
  attr String name;
  attr String description;
  val Task[*] tasks;
  val Person[*] people;
}

class Task {
  attr String title;
  attr int start;
  attr int duration;
  val Effort[*] effort;
}

class Person {
  attr String name;
  ref Skill[*] skills;
}

class Effort {
  ref Person person;
  attr int percentage = 100;
}

class Skill {
  attr String name;
}</code></pre>
<h2 id="getting-started">Getting started<a class="headerlink" href="#getting-started" title="Permanent link">&para;</a></h2>
<ul>
<li>Create a text file named <code>psl.emf</code> in your workspace and place the Emfatic content above in it.</li>
<li>Convert it into Ecore and register the produced Ecore metamodel
    (<code>psl.ecore</code>) as shown
    <a href="../articles/reflective-emf-tutorial">here</a>.</li>
<li>Create a new text file named <code>acme.flexmi</code> and place the XML content above in it.</li>
<li>The result should look like the screenshot below.</li>
</ul>
<p><img alt="" src="screenshot.png" /></p>
<h2 id="fuzzy-parsing">Fuzzy Parsing<a class="headerlink" href="#fuzzy-parsing" title="Permanent link">&para;</a></h2>
<p>The Flexmi parser uses fuzzy matching to map the tags in the XML document to instances of EClasses in the target metamodel. In Flexmi, attributes and non-containment references are captured using XML attributes. Multiple values can be captured in a single XML attribute as comma-delimited strings as shown below.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;_&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="w"> </span><span class="na">skills=</span><span class="s">&quot;Java, HTML&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;skill</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Java&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;skill</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;HTML&quot;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/_&gt;</span>
</code></pre></div>
<p>Containment references are captured using XML element containment. If an XML element has attributes, the Flexmi parser will compare its tag against EClass/EReference names expected in the context and choose the best match. For example, when it encounters the <code>&lt;person&gt;</code> element below, knowing that it is already in the context of <code>Project</code> it will match the name <code>person</code> against the names of the containment references of <code>Project</code> (<code>tasks</code>, <code>people</code>) and (all the sub-types of) their types (<code>Person</code>, <code>Task</code>) and will decide that the best match for it is <code>Person</code>.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span>...
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<p>As such, it will create an instance of <code>Person</code> and will then try to find a suitable containment reference for it (<code>people</code>). If there were multiple containment references of type <code>Person</code> in class <code>Project</code>, we could help the Flexmi parser by either using the name of the target reference instead or <code>person</code>, or by using an empty container element as follows.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;people&gt;</span>
<span class="w">    </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/people&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<h3 id="non-containment-reference-resolution">Non-Containment Reference Resolution<a class="headerlink" href="#non-containment-reference-resolution" title="Permanent link">&para;</a></h3>
<p>To resolve non-containment references, Flexmi needs target elements to have some kind of ID. If a class has an EAttribute marked as <code>id</code>, Flexmi will use that to identify its instances, otherwise, it will use the value of the <code>name</code> attribute, if present. Fully-qualified ID paths, separated by <code>.</code> are also supported.</p>
<h3 id="long-attribute-values">Long Attribute Values<a class="headerlink" href="#long-attribute-values" title="Permanent link">&para;</a></h3>
<p>XML elements can also be used instead of XML attributes to capture long/multiline EAttributes. For example, we can use a <code>&lt;description&gt;</code> nested element instead of an attribute as below.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;description&gt;</span>
<span class="w">    </span>Lorem<span class="w"> </span>ipsum<span class="w"> </span>dolor<span class="w"> </span>sit<span class="w"> </span>amet,
<span class="w">    </span>consectetur<span class="w"> </span>adipiscing<span class="w"> </span>elit,
<span class="w">    </span>sed<span class="w"> </span>do<span class="w"> </span>eiusmod<span class="w"> </span>tempor<span class="w"> </span>incididunt
<span class="w">    </span>ut<span class="w"> </span>labore<span class="w"> </span>et<span class="w"> </span>dolore<span class="w"> </span>magna<span class="w"> </span>aliqua.
<span class="w">  </span><span class="nt">&lt;/description&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<p>To keep very long values out of Flexmi models altogether, appending an <code>_</code> to the name of an attribute will instruct the Flexmi parser to look for a file with that name and parse its content as the value of the attribute as shown below.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="w"> </span><span class="na">description_=</span><span class="s">&quot;readme.txt&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<h3 id="attribute-assignment">Attribute Assignment<a class="headerlink" href="#attribute-assignment" title="Permanent link">&para;</a></h3>
<p>The Flexmi parser uses an implementation of the <a href="https://en.wikipedia.org/wiki/Hungarian_algorithm">Hungarian algorithm</a> to decide the best match of XML attribute names to EAttribute and non-containment EReference names.
Containment EReference names are currently ignored during matching.</p>
<h2 id="executable-attributes">Executable Attributes<a class="headerlink" href="#executable-attributes" title="Permanent link">&para;</a></h2>
<p>Prepending <code>:</code> to the name of an attribute instructs the Flexmi parser to interpret its value as an executable <a href="../eol">EOL</a> expression instead of a literal value. Also, Flexmi supports attaching a <code>:var</code> or a <code>:global</code> attribute to XML elements, to declare local/global variables that can be used in EOL expressions. The scope of local variables includes siblings of the element, and their descendants, while global variables can be accessed from anywhere in the model.</p>
<p>For example, in the Flexmi model below, the <code>Design</code> task is assigned to a local variable named <code>design</code>, which is then used to compute the value of the <code>start</code> time of the implementation task.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Analysis&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Design&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;4&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;6&quot;</span><span class="w"> </span><span class="na">:var=</span><span class="s">&quot;design&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Implementation&quot;</span><span class="w"> </span><span class="na">:start=</span><span class="s">&quot;design.start + design.duration + 1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<p>You can also use <code>:var</code>/<code>:global</code> and EOL attributes to refer to model elements without using names/ids as identifiers. For example, in the version, below, <code>Alice</code> is attached to the local variable name <code>alice</code>, which is then used in the <code>:person</code> reference of the second effort of the <code>Implementation</code> task.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="w"> </span><span class="na">:var=</span><span class="s">&quot;alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Analysis&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Design&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;4&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;6&quot;</span><span class="w"> </span><span class="na">:var=</span><span class="s">&quot;design&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Implementation&quot;</span><span class="w"> </span><span class="na">:start=</span><span class="s">&quot;design.start+design.duration+1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Bob&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">:person=</span><span class="s">&quot;alice&quot;</span><span class="w"> </span><span class="na">perc=</span><span class="s">&quot;50&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<h2 id="object-initialization">Object Initialization<a class="headerlink" href="#object-initialization" title="Permanent link">&para;</a></h2>
<p>An XML element representing an object can have an <code>:init</code> child with complex EOL-based initialization logic.
For example, this would initialize the "Analysis" task to have an Effort child pointing to the first Person in the model:</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Bob&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Analysis&quot;</span><span class="w"> </span><span class="na">start=</span><span class="s">&quot;1&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;:init&gt;</span>
<span class="w">      </span>var<span class="w"> </span>effort<span class="w"> </span>=<span class="w"> </span>new<span class="w"> </span>Effort();
<span class="w">      </span>self.effort.add(effort);
<span class="w">      </span>effort.person<span class="w"> </span>=<span class="w"> </span>Person.all.first();
<span class="w">    </span><span class="nt">&lt;/:init&gt;</span>
<span class="w">  </span><span class="nt">&lt;/task&gt;</span>
<span class="nt">&lt;/project&gt;</span>
</code></pre></div>
<div class="admonition warning">
<p class="admonition-title">ITool instances not available</p>
<p>Since Flexmi is designed to work from outside Eclipse, <a href="../articles/call-java-from-epsilon/">Eclipse extension point-based tools</a> are not available from Flexmi EOL code.</p>
</div>
<h2 id="including-and-importing-other-flexmi-models">Including and Importing other Flexmi Models<a class="headerlink" href="#including-and-importing-other-flexmi-models" title="Permanent link">&para;</a></h2>
<p>Flexmi supports the <code>&lt;?import other.flexmi?&gt;</code> and <code>&lt;?include other.flexmi?&gt;</code> processing instructions. <code>import</code> creates a new resource for <code>other.flexmi</code> while <code>include</code> parses the contents of <code>other.flexmi</code> as if they were embedded in the Flexmi model that contains the <code>include</code> processing instruction.</p>
<h2 id="instantiating-types-from-multiple-ecore-metamodels">Instantiating Types from Multiple Ecore Metamodels<a class="headerlink" href="#instantiating-types-from-multiple-ecore-metamodels" title="Permanent link">&para;</a></h2>
<p>Multiple <code>&lt;?nsuri metamodeluri?&gt;</code> processing instructions can be used in the preamble of a Flexmi model, allowing it to instantiate multiple Ecore metamodels. However, in case of name clashes between them, there's no good way for disambiguation.</p>
<h2 id="models-with-multiple-root-elements">Models with Multiple Root Elements<a class="headerlink" href="#models-with-multiple-root-elements" title="Permanent link">&para;</a></h2>
<p>If you need to have multiple top-level elements in your model, you can add them under a <code>&lt;_&gt;</code> root element, which has no other semantics.</p>
<h2 id="reusable-templates">Reusable Templates<a class="headerlink" href="#reusable-templates" title="Permanent link">&para;</a></h2>
<p>Flexmi supports defining reusable templates through the reserved <code>&lt;:template&gt;</code> XML tag. For example, when designing one-person projects where all tasks take place in sequence, we can omit all the repetitive <code>&lt;effort&gt;</code> elements that refer to the same person, and we can automate the calculation of the start date of each task using a <code>simpletask</code> template, as shown below.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;_&gt;</span>
<span class="w">  </span><span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;simpletask</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Analysis&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;simpletask</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Design&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;simpletask</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Implementation&quot;</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;6&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/project&gt;</span>

<span class="w">  </span><span class="nt">&lt;:template</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;simpletask&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;content&gt;</span>
<span class="w">      </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">:start=</span><span class="s">&quot;Task.all.indexOf(self).asVar(&#39;index&#39;) == 0 ? 1 : Task.all.get(index-1).asVar(&#39;previous&#39;).start + previous.duration&quot;</span><span class="nt">&gt;</span>
<span class="w">        </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">:person=</span><span class="s">&quot;Person.all.first()&quot;</span><span class="nt">/&gt;</span>
<span class="w">      </span><span class="nt">&lt;/task&gt;</span>
<span class="w">    </span><span class="nt">&lt;/content&gt;</span>
<span class="w">  </span><span class="nt">&lt;/:template&gt;</span>
<span class="nt">&lt;/_&gt;</span>
</code></pre></div>
<h3 id="parameters">Parameters<a class="headerlink" href="#parameters" title="Permanent link">&para;</a></h3>
<p>Flexmi templates also support parameters, which can be used to configure the content they produce when they are invoked. An example is shown below:</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;_&gt;</span>
<span class="w">  </span><span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;design</span><span class="w"> </span><span class="na">dur=</span><span class="s">&quot;3&quot;</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">  </span><span class="nt">&lt;/project&gt;</span>

<span class="w">  </span><span class="nt">&lt;:template</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;design&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;parameter</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;person&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;content&gt;</span>
<span class="w">      </span><span class="nt">&lt;task</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Design&quot;</span><span class="nt">&gt;</span>
<span class="w">        </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;${person}&quot;</span><span class="nt">/&gt;</span>
<span class="w">      </span><span class="nt">&lt;/task&gt;</span>
<span class="w">    </span><span class="nt">&lt;/content&gt;</span>
<span class="w">  </span><span class="nt">&lt;/:template&gt;</span>
<span class="nt">&lt;/_&gt;</span>
</code></pre></div>
<h3 id="dynamic-templates-and-slots">Dynamic Templates and Slots<a class="headerlink" href="#dynamic-templates-and-slots" title="Permanent link">&para;</a></h3>
<p>To further customise the content that Flexmi templates produce, one can use an <a href="../egl">EGL</a> template that produces XML as the value of the <code>&lt;content&gt;</code> element of the template, by setting it's language to EGL as shown below. Also Flexmi supports a <code>&lt;:slot&gt;</code> element in the content of templates, which specifies where any nested elements of the caller should be placed in the produced XML as shown below.</p>
<div class="highlight"><pre><span></span><code><span class="cp">&lt;?nsuri psl?&gt;</span>
<span class="nt">&lt;_&gt;</span>
<span class="w">  </span><span class="nt">&lt;project</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;ACME&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;person</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;longtask</span><span class="w"> </span><span class="na">title=</span><span class="s">&quot;Implementation&quot;</span><span class="w"> </span><span class="na">years=</span><span class="s">&quot;2&quot;</span><span class="nt">&gt;</span>
<span class="w">      </span><span class="nt">&lt;effort</span><span class="w"> </span><span class="na">person=</span><span class="s">&quot;Alice&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;/longtask&gt;</span>
<span class="w">  </span><span class="nt">&lt;/project&gt;</span>

<span class="w">  </span><span class="nt">&lt;:template</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;longtask&quot;</span><span class="nt">&gt;</span>
<span class="w">    </span><span class="nt">&lt;parameter</span><span class="w"> </span><span class="na">name=</span><span class="s">&quot;years&quot;</span><span class="nt">/&gt;</span>
<span class="w">    </span><span class="nt">&lt;content</span><span class="w"> </span><span class="na">language=</span><span class="s">&quot;EGL&quot;</span><span class="nt">&gt;</span>
<span class="w">      </span><span class="cp">&lt;![CDATA[</span>
<span class="cp">      &lt;task duration=&quot;[%=years.asInteger()*12%]&quot;&gt;</span>
<span class="cp">        &lt;:slot/&gt;</span>
<span class="cp">      &lt;/task&gt;</span>
<span class="cp">      ]]&gt;</span>
<span class="w">    </span><span class="nt">&lt;/content&gt;</span>
<span class="w">  </span><span class="nt">&lt;/:template&gt;</span>
<span class="nt">&lt;/_&gt;</span>
</code></pre></div>
<h3 id="reusing-templates-in-different-flexmi-models">Reusing Templates in Different Flexmi Models<a class="headerlink" href="#reusing-templates-in-different-flexmi-models" title="Permanent link">&para;</a></h3>
<p>Templates can be stored in separate Flexmi files and be imported from different models using Flexmi's <code>&lt;?include ?&gt;</code> processing instruction.</p>
<h2 id="use-in-epsilon-and-java">Use in Epsilon and Java<a class="headerlink" href="#use-in-epsilon-and-java" title="Permanent link">&para;</a></h2>
<p>Flexmi offers and registers an implementation of <a href="http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.3/org/eclipse/emf/ecore/resource/Resource.html">EMF's Resource interface</a> (<code>FlexmiResource</code>), and can be used like any other EMF resource implementation. For example, you can add <code>.flexmi</code> models as regular EMF models to the run configuration of your Epsilon program. An example of using Flexmi from Java follows.</p>
<div class="highlight"><pre><span></span><code><span class="n">ResourceSet</span><span class="w"> </span><span class="n">resourceSet</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">new</span><span class="w"> </span><span class="n">ResourceSetImpl</span><span class="p">();</span>
<span class="n">resourceSet</span><span class="p">.</span><span class="na">getResourceFactoryRegistry</span><span class="p">().</span>
<span class="w">  </span><span class="n">getExtensionToFactoryMap</span><span class="p">().</span><span class="na">put</span><span class="p">(</span><span class="s">&quot;flexmi&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="k">new</span><span class="w"> </span><span class="n">FlexmiResourceFactory</span><span class="p">());</span>
<span class="n">Resource</span><span class="w"> </span><span class="n">resource</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">resourceSet</span><span class="p">.</span><span class="na">createResource</span>
<span class="w">  </span><span class="p">(</span><span class="n">URI</span><span class="p">.</span><span class="na">createFileURI</span><span class="p">(</span><span class="s">&quot;/../acme.flexmi&quot;</span><span class="p">));</span>
<span class="n">resource</span><span class="p">.</span><span class="na">load</span><span class="p">(</span><span class="kc">null</span><span class="p">);</span>
</code></pre></div>
<h2 id="converting-to-xmi">Converting to XMI<a class="headerlink" href="#converting-to-xmi" title="Permanent link">&para;</a></h2>
<p>You can convert a Flexmi model to standard XMI (with no templates, executable attributes etc.) by right-clicking on it in the Project Explorer view and selecting <code>Generate XMI</code>.</p>
<p>Converting an XMI model to Flexmi on the other hand is not supported as there's no unique mapping in this direction.</p>
<h2 id="yaml-flavour">YAML Flavour<a class="headerlink" href="#yaml-flavour" title="Permanent link">&para;</a></h2>
<p>Since Epsilon 2.3.0, Flexmi also supports a YAML flavour. Equivalent YAML representations for the XML-based model at the top of this page are shown below.</p>
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>The YAML flavour of Flexmi supports all the features of the XML flavour, including <a href="#reusable-templates">plain</a> and <a href="#dynamic-templates-and-slots">dynamic templates</a>, and <a href="#executable-attributes">executable attributes</a>. Also, it is worth noting that YAML is a superset of JSON.</p>
</div>
<div class="tabbed-set tabbed-alternate" data-tabs="1:2"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Indentation-based</label><label for="__tabbed_1_2">Curly brackets-based</label></div>
<div class="tabbed-content">
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code><span class="l l-Scalar l-Scalar-Plain">?nsuri</span><span class="p p-Indicator">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">psl</span>
<span class="nt">project</span><span class="p">:</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ACME</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">task</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Analysis</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">start</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">1</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">dur</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">task</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Design</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">start</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">4</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">dur</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">6</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">task</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Implementation</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">start</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">7</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">dur</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">,</span><span class="nt"> perc</span><span class="p">:</span><span class="w"> </span><span class="nv">50</span><span class="p p-Indicator">}</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">,</span><span class="nt"> perc</span><span class="p">:</span><span class="w"> </span><span class="nv">50</span><span class="p p-Indicator">}</span>
</code></pre></div>
</div>
<div class="tabbed-block">
<div class="highlight"><pre><span></span><code><span class="l l-Scalar l-Scalar-Plain">?nsuri</span><span class="p p-Indicator">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">psl</span>
<span class="nt">project</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span>
<span class="nt">  name</span><span class="p">:</span><span class="w"> </span><span class="nv">ACME</span><span class="p p-Indicator">,</span>
<span class="nt">  person</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">},</span>
<span class="nt">  person</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">},</span>
<span class="nt">  task</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span>
<span class="nt">    title</span><span class="p">:</span><span class="w"> </span><span class="nv">Analysis</span><span class="p p-Indicator">,</span>
<span class="nt">    start</span><span class="p">:</span><span class="w"> </span><span class="nv">1</span><span class="p p-Indicator">,</span>
<span class="nt">    dur</span><span class="p">:</span><span class="w"> </span><span class="nv">3</span><span class="p p-Indicator">,</span>
<span class="nt">    effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">}</span>
<span class="w">  </span><span class="p p-Indicator">},</span>
<span class="nt">  task</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span>
<span class="nt">    title</span><span class="p">:</span><span class="w"> </span><span class="nv">Design</span><span class="p p-Indicator">,</span>
<span class="nt">    start</span><span class="p">:</span><span class="w"> </span><span class="nv">4</span><span class="p p-Indicator">,</span>
<span class="nt">    dur</span><span class="p">:</span><span class="w"> </span><span class="nv">6</span><span class="p p-Indicator">,</span>
<span class="nt">    effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">}</span>
<span class="w">  </span><span class="p p-Indicator">},</span>
<span class="nt">  task</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span>
<span class="nt">    title</span><span class="p">:</span><span class="w"> </span><span class="nv">Implementation</span><span class="p p-Indicator">,</span>
<span class="nt">    start</span><span class="p">:</span><span class="w"> </span><span class="nv">7</span><span class="p p-Indicator">,</span>
<span class="nt">    dur</span><span class="p">:</span><span class="w"> </span><span class="nv">3</span><span class="p p-Indicator">,</span>
<span class="nt">    effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Bob</span><span class="p p-Indicator">,</span><span class="nt"> perc</span><span class="p">:</span><span class="w"> </span><span class="nv">50</span><span class="p p-Indicator">},</span>
<span class="nt">    effort</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="nv">Alice</span><span class="p p-Indicator">,</span><span class="nt"> perc</span><span class="p">:</span><span class="w"> </span><span class="nv">50</span><span class="p p-Indicator">}</span>
<span class="w">  </span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">}</span>
</code></pre></div>
</div>
</div>
</div>
<p>For multi-valued attributes and non-containment references, comma-separated values, or lists of scalars can be used as shown below.</p>
<div class="highlight"><pre><span></span><code><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">?nsuri</span><span class="p p-Indicator">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">psl</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Alice</span><span class="w"> </span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">skills</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Java, HTML</span><span class="w"> </span><span class="c1"># Comma-separated</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Bob</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">skills</span><span class="p">:</span><span class="w"> </span><span class="c1"># List of scalars</span>
<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Java</span>
<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">HTML</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">skill</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">Java</span><span class="p p-Indicator">}</span>
<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">skill</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="nv">HTML</span><span class="p p-Indicator">}</span>
</code></pre></div>
<div class="admonition tip">
<p class="admonition-title">Tabs vs. Spaces</p>
<p>If your YAML-flavoured Flexmi model doesn't parse (i.e. the outline view of the Flexmi editor is empty), you may want to check that you have not accidentally used tabs instead of spaces for indentation.</p>
</div>
<p>The Flexmi parser auto-detects whether a file is XML-based or YAML-based and parses it accordingly. As such, you should be able to edit YAML-flavoured <code>*.flexmi</code> files in the Flexmi editor. Additional examples of YAML-flavoured Flexmi models are available in this <a href="https://github.com/eclipse/epsilon/tree/main/tests/org.eclipse.epsilon.flexmi.test/src/org/eclipse/epsilon/flexmi/test/models">test project</a> (look for <code>*.yaml</code> files).</p>
<h3 id="dynamic-templates-in-yaml">Dynamic Templates in YAML<a class="headerlink" href="#dynamic-templates-in-yaml" title="Permanent link">&para;</a></h3>
<p>The YAML flavour requires a <code>script</code> attribute in the <code>content</code> of dynamic templates, that holds the EGL script used to dynamically produce the YAML content. The YAML equivalent of the XML-based dynamic template <a href="#dynamic-templates-and-slots">shown above</a> is as follows.</p>
<div class="highlight"><pre><span></span><code><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">?nsuri</span><span class="p p-Indicator">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">psl</span>

<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">project</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ACME</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Alice</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">longtask</span><span class="p">:</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">title</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Implementation</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">years</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">2</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">effort</span><span class="p">:</span>
<span class="w">      </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">person</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Alice</span>

<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">:template</span><span class="p">:</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">longtask</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">parameter</span><span class="p">:</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">years</span>
<span class="w">  </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">content</span><span class="p">:</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">EGL</span>
<span class="w">    </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">|-</span><span class="w"> </span><span class="c1"># Multi-line EGL script</span>
<span class="w">       </span><span class="no">- task:</span>
<span class="w">         </span><span class="no">- duration: [%=years.asInteger()*12%]</span>
<span class="w">         </span><span class="no">- :slot</span>
</code></pre></div>
<h2 id="philosophy">Philosophy<a class="headerlink" href="#philosophy" title="Permanent link">&para;</a></h2>
<p>Flexmi was originally developed as a quick and dirty way to type in EMF models without having to define an Xtext grammar or adhere to the rigid naming rules of XMI or HUTN. The name is a combination of the word "flexible" and the "XMI" acronym.</p>
<h2 id="limitations">Limitations<a class="headerlink" href="#limitations" title="Permanent link">&para;</a></h2>
<ul>
<li>Flexmi resources can't be saved programmatically (i.e. trying to call <code>resource.save(...)</code> will do nothing).</li>
<li>There is no code completion in the Flexmi editor at the moment.</li>
</ul>
<h2 id="resources">Resources<a class="headerlink" href="#resources" title="Permanent link">&para;</a></h2>
<ul>
<li>More examples of using Flexmi can be found in projects containing <code>flexmi</code> in their name, under the <a href="https://github.com/eclipse/epsilon/tree/main/examples">examples folder</a> of Epsilon's Git repository.</li>
<li><a href="../articles/running-epsilon-ant-tasks-from-command-line/#flexmi-and-emfatic">This article</a> shows how to use Flexmi models in ANT/Gradle/Maven builds</li>
<li>Flexmi and relevant underpinning research is further described in the following papers:<ul>
<li><a href="http://ceur-ws.org/Vol-1694/FlexMDE2016_paper_3.pdf">Towards Flexible Parsing of StructuredTextual Model Representations</a></li>
<li><a href="http://ceur-ws.org/Vol-2245/flexmde_paper_3.pdf">Towards a Modular and Flexible Human-UsableTextual Syntax for EMF Models</a></li>
<li><a href="https://link.springer.com/article/10.1007/s10270-018-0658-5">Type Inference in Flexible Model-Driven Engineering using Classification Algorithms</a></li>
</ul>
</li>
</ul>





                
              </article>
            </div>
          
          
  <script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var tab,labels=set.querySelector(".tabbed-labels");for(tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script>

        </div>
        
      </main>
      
        <footer class="md-footer">
  
    
      
      <nav class="md-footer__inner md-grid" aria-label="Footer" >
        
          
          <a href="../picto/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Picto" rel="prev">
            <div class="md-footer__button md-icon">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
            </div>
            <div class="md-footer__title">
              <span class="md-footer__direction">
                Previous
              </span>
              <div class="md-ellipsis">
                Picto
              </div>
            </div>
          </a>
        
        
          
          <a href="../eugenia/" class="md-footer__link md-footer__link--next" aria-label="Next: Eugenia" rel="next">
            <div class="md-footer__title">
              <span class="md-footer__direction">
                Next
              </span>
              <div class="md-ellipsis">
                Eugenia
              </div>
            </div>
            <div class="md-footer__button md-icon">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
            </div>
          </a>
        
      </nav>
    
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-copyright">
  
    <div class="md-copyright__highlight">
      Copyright © <a href="https://www.eclipse.org">Eclipse Foundation, Inc.</a> All Rights Reserved <br/> <a href="https://www.eclipse.org/legal/privacy.php">Privacy Policy</a> &centerdot; <a href="https://www.eclipse.org/legal/termsofuse.php">Terms of Use</a> &centerdot; <a href="https://www.eclipse.org/legal/copyright.php">Copyright Agent</a>  &centerdot; <a href="https://www.eclipse.org/legal/">Legal</a><p><img src="https://eclipse.dev/epsilon/assets/images/eclipse-foundation-logo.svg"/></p>
    </div>
  
  
    Made with
    <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
      Material for MkDocs
    </a>
  
</div>
      
        <div class="md-social">
  
    
    
    
    
      
      
    
    <a href="https://twitter.com/eclipseepsilon" target="_blank" rel="noopener" title="twitter.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
    </a>
  
    
    
    
    
      
      
    
    <a href="https://youtube.com/epsilondevs" target="_blank" rel="noopener" title="youtube.com" class="md-social__link">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"/></svg>
    </a>
  
</div>
      
    </div>
  </div>
</footer>
      
    </div>
    <div class="md-dialog" data-md-component="dialog">
      <div class="md-dialog__inner md-typeset"></div>
    </div>
    
    <script id="__config" type="application/json">{"base": "../..", "features": ["content.code.copy", "content.tabs.link", "navigation.footer"], "search": "../../assets/javascripts/workers/search.74e28a9f.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script>
    
    
      <script src="../../assets/javascripts/bundle.220ee61c.min.js"></script>
      
        
          <script src="https://unpkg.com/mermaid@8.5.1/dist/mermaid.min.js"></script>
        
      
        
          <script src="../../assets/javascript/mermaid.js"></script>
        
      
        
          <script src="../../assets/javascript/jquery.js"></script>
        
      
        
          <script src="../../assets/javascript/slick.min.js"></script>
        
      
        
          <script src="../../assets/javascript/google-code-prettify/prettify.js"></script>
        
      
        
          <script src="../../assets/javascript/google-code-prettify/lang-emfatic.js"></script>
        
      
        
          <script src="../../assets/javascript/google-code-prettify/lang-epsilon.js"></script>
        
      
        
          <script src="../../assets/javascript/google-code-prettify/prettyprint.js"></script>
        
      
        
          <script src="../../assets/javascript/extra.js"></script>
        
      
        
          <script src="https://w.appzi.io/w.js?token=jlv6W"></script>
        
      
    
  </body>
</html>